//
//  CommonTableViewCell.swift
//  Exchange
//
//  Created by 孟祥群 on 2018/4/19.
//  Copyright © 2018年 common. All rights reserved.
//

import UIKit
class CommonTableViewCell: BaseTableViewCell {
    var needArrow: Bool = true
    
    lazy var textField: BaseTextField = {
        let textField = BaseTextField(changeView: nil, szBounds: CGRect.zero)
        textField.clearButtonMode = UITextFieldViewMode.whileEditing
        textField.themeTextColor  = ThemeManager.ThemeColorKeys.text1
        textField.font = UIFont.systemFont(ofSize: 15)
        textField.setValue(UIFont.systemFont(ofSize: 15), forKeyPath: "_placeholderLabel.font")
        return textField
    }()
    
    lazy var numTextField: NumberTextField = {
        let textField = NumberTextField(changeView: nil, szBounds: CGRect.zero)
        textField.clearButtonMode = UITextFieldViewMode.whileEditing
        return textField
    }()
    
    lazy var passWordTextField: PassWordTextField = {
        let textField = PassWordTextField(changeView: nil, szBounds: CGRect.zero)
        textField.clearButtonMode = UITextFieldViewMode.whileEditing
        return textField
    }()
    
     init(style: UITableViewCellStyle, reuseIdentifier: String?, needArrow: Bool = true) {
        self.needArrow = needArrow
        super.init(style: style, reuseIdentifier: reuseIdentifier)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    override func setUpUI() -> Void {
        super.setUpUI()
        self.contentView .addSubview(textField)
//        textField.snp.makeConstraints { (make) in
//            make.left.equalToSuperview().offset(16)
//            make.top.bottom.equalToSuperview()
//            make.right.equalToSuperview().offset(-100)
//        }
        
        self.nameLabel.text = ""
    
        
        self.contentView.addSubview(self.kindLabel)
        self.kindLabel.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.right.equalToSuperview().offset(-47)
        }
     
    }
    
    func setAdverStyle() {
        self.setArrowImage()
        self.nameLabel.font = UIFont.systemFont(ofSize: 12)
        self.textField.snp.updateConstraints { (make) in
            make.left.equalToSuperview().offset(16)
            make.right.equalToSuperview().offset(-90)
        }
        self.textField.keyboardType = UIKeyboardType.decimalPad
        self.textField.setValue(UIFont.systemFont(ofSize: 12), forKeyPath: "_placeholderLabel.font")
        self.textField.setPlaceholderColor()
        self.contentView.addSubview(self.kindLabel)
        self.kindLabel.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.right.equalToSuperview().offset(-47)
        }
        self.backArrorImage.snp.updateConstraints { (make) in
            make.right.equalToSuperview().offset(-47)
        }
    }
    
//    func changeInforColor(text:String) {
//        if text.count != 0 {
//            self.inforLabel.themeTextColor = ThemeManager.ThemeColorKeys.text1
//            self.inforLabel.font = UIFont.systemFont(ofSize: 15)
//        }else {
//            self.inforLabel.font = UIFont.systemFont(ofSize: 13)
//            if ThemeManager.default.currentThemeMode() == .night {
//                self.inforLabel.textColor  =  UIColor(hexStr: "#616979")
//            }else {
//                self.inforLabel.textColor  = UIColor(hexStr: "#b1b2b2")
//            }
//        }
//        
//    }
    
    func setIteam(_ item:CYTableviewItem) {

    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

}
